﻿using EntytiBookShop.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntytiBookShop.DAL
{
    public class BookShopInitializer : DropCreateDatabaseIfModelChanges<BookShopContext>
    {
        protected override void Seed(BookShopContext context)
        {
            List<Category> categories = new List<Category>();
            categories.Add(new Category() { CategoryName = "ScinceFiction"});
            categories.Add(new Category() { CategoryName = "Fantasy" });
            categories.Add(new Category() { CategoryName = "Tragedy" });
            categories.Add(new Category() { CategoryName = "Crime Story" });
            categories.Add(new Category() { CategoryName = "Fiction" });

            categories.ForEach(c => context.Categories.Add(c));
            context.SaveChanges();
           base.Seed(context);
        }
    }

}
